#define quickread
#ifdef quickread
#include <cstdio> 
template <typename T>
inline void read(T& x)
{
    int c=getchar(), f=1; x=0;
    while(c<'0'||'9'<c) {if(c=='-') f=-1; c=getchar();}
    while('0'<=c&&c<='9') 
        x=(x<<3)+(x<<1)+c-'0', c=getchar();
    x*=f;
}
template <typename T>
inline void quickwrite(T x)
{
    if(x<0) putchar('-'), x*=-1;
    if(x>=10) quickwrite(x/10);
    putchar(x%10+'0');
}
#else 
#include <iostream>
#endif
#include <algorithm>
using namespace std;
#define DEBUG
/*
G a
B a
A b 一定进
W c 一定不进

G *** B 

初始在三分线
至少完成四组动作并回到三分线，考试结束
30s内完成满分
46s后0分
*/
const int N=110;
int a, b, c;
int fail, cnt, ans;
bool back;
char S[N];
void init()
{
    read(a), read(b), read(c);
    scanf("%s", S);
}

void solve()
{
    init();
    for(int i=0; i<sizeof S; i++)
    {
        int op=S[i];
        switch(op)
        {
            case 'G': ans+=a, back=false; break;
            case 'A': fail=3, ans+=b; break;
            case 'W': fail=min(fail+1, 3), ans+=c, back=false; break;
            case 'B': ans+=a, back=true; if(fail==3) cnt++; fail=0; break;

        }
    }
    if(cnt>=4) //4轮结束
    {
        quickwrite(ans+(back?0:a)); puts(""); return;
    }
    if(!back) //当前序列的最后一轮没结束
    {
        ans+=min((3-fail)*c, b)+a; cnt++;
    }
    ans+=(4-cnt)*(2*a+min(3*c, b));
    quickwrite(ans); puts("");
}

// #undef DEBUG
signed main()
{
    #ifdef DEBUG
        freopen("../in.txt", "r", stdin);
        freopen("../out.txt", "w", stdout);
    #endif
    #ifndef quickread
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    #endif

    int T=1; //scanf("%d", &T);
    while(T--) 
    {
        solve();
    }
    return 0;
}
